#!/bin/bash
SPOOL=/var/spool/mail/gnawux
LED=/proc/acpi/asus/mled
SLEEP=60
while true;
do
    DISP=`cat $LED`;
    if [ ! -s $SPOOL  -a $DISP -gt 0 ];
    then
	echo -n "0" > $LED;
    elif [ $DISP -eq 0  -a -s $SPOOL ];
    then
	echo -n "1" > $LED;
	aplay /usr/share/sounds/gaim/receive.wav
    fi
    sleep $SLEEP
done
